package com.tuanbiao.controllers;

import android.view.KeyEvent;

import com.hzjq.data.entity.CapDelayEntity;
import com.hzjq.data.entity.UIDRule;
import com.hzjq.data.hzjq.entity.CapRecordEntity;
import com.hzjq.lib.bean.PlanInfo;
import com.hzjq.lib.cap.bean.ScanResult;
import com.tuanbiao.base.mvp.IModel;
import com.tuanbiao.base.mvp.IPresenter;
import com.tuanbiao.base.mvp.IView;
import com.tuanbiao.constants.Constants;
import com.tuanbiao.data.entity.KeepSortItem;
import com.tuanbiao.models.action.AuthAction;
import com.tuanbiao.models.action.DelayAction;
import com.tuanbiao.models.action.DetonatorAction;
import com.tuanbiao.models.action.PlanAction;
import com.tuanbiao.models.action.ProjectAction;
import com.tuanbiao.models.action.SettingAction;
import com.tuanbiao.models.action.SortAction;

import java.util.ArrayList;
import java.util.List;

/**
 * @author abiao
 * @since 2022/4/8 14:56
 */
public interface DetonatorController {
    interface Model extends IModel, ProjectAction, DelayAction, DetonatorAction, PlanAction, AuthAction, SortAction, SettingAction {

    }

    interface RegisterView extends IView {

        void refresh();

        void showStatistics(PlanInfo planInfo);
//
//        void showStatisticsDetonator(long count, long row, long column);
//
//        void showStatisticsDelay(long minDelay, long maxDelay);

        void showF1Delay(long delay);

        void showF2Delay(long delay);

        void setDetonators(List<CapRecordEntity> entities);

        void addDetonators(List<CapRecordEntity> newCaps);

//        void addDetonators(CapRecordEntity newCaps);
//
//        void onDetonatorDelete(CapRecordEntity entity);
//
//        void onDetonatorDelete(List<CapRecordEntity> entities);

        void onDetonatorChange(CapRecordEntity entity);

        void onScannerTypeChange(boolean isScanner);

        void backupLoading();

        void hideBackupLoading();

        void showRepeatDialog(int size, ArrayList<CapRecordEntity> repeatCaps);

        void showAddRow(boolean addNewRow);

        void showScanRepeat(CapDelayEntity entity, ScanResult scanResult);

        void scrollToPosition(String uid);

        int getDetonatorCount();

        void showUidError(long uidErrorCount);



    }

    interface RegisterPresenter extends IPresenter {
        int getMaxCapCount();

        void getDetonatorsByPlanId();

        void toggleAddNewRow();

        void updateFDelay(@Constants.ScannerKeyCode int scannerCode, String content);

        void menuReadOnline(int count);

        void menuInsertDetonator(CapRecordEntity selectEntity, String uid, String delay, String row, String column, UIDRule rule);

        void menuUpdateDelays(boolean keepSort, String startDelay, String rowDelay, String columnDelay);

        boolean checkUpdateDelays(KeepSortItem keepSortItem, String startDelay, String rowDelay, String columnDelay);

        void menuSort(List<CapRecordEntity> entities, @Constants.DetonatorSortType String sortType, @Constants.DetonatorOrderType String orderType);

        void menuClearDetonator();

        void menuDeleteSelectedDetonator(List<CapRecordEntity> entities);

        void menuBackUpPlan(String content);

        void menuSetRow(String content);

        void deleteDetonator(CapRecordEntity entity);

        void updateDetonator(CapRecordEntity entity);

        long getMaxDelay();

        boolean onKeyDown(int keyCode, KeyEvent event);

        void overRepeatCaps(ArrayList<CapRecordEntity> caps,Runnable run);

        void copyCap();

//        void authDetonator(List<CapRecordEntity> data);
    }
}
